<?php

class Value {

    protected $mValue;

    protected function __construct(
        $mValue = null
        ) {

        if($mValue !== null) {
            $this->set($mValue);
        }

    }

    public function set(
        $mValue = null
        ) {

        $this->mValue = $mValue;

        return $this;

    }

    public function get() {

        return $this->mValue;

    }

    public function isEmpty() {

        return $this->mValue === null;

    }

    public function isEquals($mValue) {

        if(empty($this->mValue)) {
            return $this->mValue === $mValue || $mValue === null;
        }

        return $this->mValue == $mValue;

    }

    public function isContains($mValue) {

        return $this->isEquals($mValue);

    }

    public static function create(
        $sType = null,
        $mValue = null
        ) {

        switch($sType) {

            case "string":
            case null:
                return new Value($mValue);
            break;

            case "number":
                return new Value_Number($mValue);
            break;

            case "boolean":
                return new Value_Boolean($mValue);
            break;

            case "list":
                return new Value_List($mValue);
            break;

            default:
                throw new Exception_ValueTypeUnsupported($sType);
            break;

        }

    }

}

?>